<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8" />
    <title>xxx</title>
    <script src="/plugin/jquery/jquery-1.9.0.min.js" type="text/javascript"></script>
    <link href="/plugin/ligerUI/skins/Aqua/css/ligerui-all.css" rel="stylesheet" type="text/css" />
    <script src="/plugin/ligerUI/js/ligerui.all.js" type="text/javascript"></script>
    <link href="/plugin/ligerUI/skins/ligerui-icons.css" rel="stylesheet" type="text/css" />
    <link href="/plugin/ligerUI/skins/Gray/css/all.css" rel="stylesheet" type="text/css" />
    <script src="/plugin/ligerUI/js/core/init-obj.js" type="text/javascript"></script>
    <script type="text/javascript">

        $(function(){
            doSearch();
        });

        function doSearch(){
            var data = $("#searchFrom").serializeArray();
            loadDataAptitude(data);
        }

        function loadDataAptitude(data){
            dataGrid   =$("#maingrid").ligerGrid({
                checkbox:true,
                height: '100%',
                columns: [
                    { display: '用户名', name: 'userName', minWidth: 120 },
                    { display: '性别', name: 'sex' ,minWidth: 140,render: function (rowdata)
                    {
                        if (rowdata.sex == 0)
                        {
                            return "女";
                        }
                        return "男";
                    }
                    },
                    { display: '账号', name: 'account',minWidth: 180 },
                    { display: '手机号码', name: 'mobile', minWidth: 140 },
                    { display: '邮箱', name: 'email' ,minWidth: 140},
                    { display: '地址', name: 'addr' ,minWidth: 140},
                    { display: '状态', name: 'status' ,minWidth: 140,render: function (rowdata)
                    {
                        if (rowdata.status == 0)
                        {
                            return "不可用";
                        }
                        return "可用";
                    }},
                    { display: '创建人', name: 'creator' ,minWidth: 140},

                    { display: '创建时间', name: 'createTime', minWidth: 140 ,type:'date'}
                ],
                parms:data,
                rownumbers: true,
                autoFilter: true,
                dataAction:"local",
                url:"/sec/user/list1",
                usePager:true,
                pageSize:"20",//分页页面大小
                pageSizeOptions:[10,20,30]//可指定每页页面大小
            });
            var s=  $(".l-panel-topbarinner .l-toolbar-item:last").find(".l-icon-search2");
            if(s.length==1){
                $(".l-panel-topbarinner .l-toolbar-item:last").remove();
            }
        }

        function itemclick(item)
        {

            var height = $(".l-layout-center").height();

            if(item=='add') {
                var objs = dataGrid.getSelecteds();
                var rids = '';
                for(var i=0 ;i<objs.length;i++){
                    rids+=objs[i].id+",";
                }

                $.ajax({
                    type: 'POST',
                    url: '/sec/user/userAddorg',
                    data: {
                        ids:rids,
                        orgId:parent.cellValOrgId()
                    },
                    dataType: 'json',
                    success: function(data){
                        if(data.code==200){
                            parent.callBack();
                        }else{
                            $.ligerDialog.error('保存失败');
                        }
                    },
                    error:function(){
                        $.ligerDialog.error('保存失败');
                    }
                });
            }
        }


    </script>
</head>
<body>
<form id="searchFrom">
</form>
<div class="tools">
    <a   onclick="itemclick('add')" >保存</a>
</div>
<div  id="maingrid"></div>
</body>
</html>